<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
    <title>按地区汇总详情</title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
                            
    <section class="content-header">
        <h1>采购计划汇总</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">采购计划汇总</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
            <div class="input">
            	<div class="textalign1">药品编码：</div>
            	<div class="boxinput">
            		<input class="textinput" type="text" id="searchDrugCode" placeholder="药品编码" maxlength="18" />
            	</div>
            	<div class="textalign">通用名：</div>
            	<div class="boxinput">
            		<input class="textinput" type="text" id="searchDrugName" placeholder="通用名" maxlength="127" />
            	</div>
            	<div class="textalign">生产企业：</div>
            	<div class="boxinput">
            		<input class="textinput" type="text" id="searchCompName" placeholder="生产企业" maxlength="127" />
            	</div>
            </div>
            <div class="input">
            	<div class="textalign1">申报单位：</div>
            	<div class="boxinput">
            		<input class="textinput" type="text" id="declareIns" placeholder="申报单位" maxlength="127" />
            	</div>
            	<div class="textalign">
            		<button type="button" class="btn btn-success btn-sm" onclick="search();" id="selectc">查询</button>
            	</div>
            </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
        <div class=" box box-warning bottongroup">
             <button onclick="history.go(-1)" class="btn btn-default btn-sm" >返&nbsp;回</button>
        </div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
			
  //绑定回车
    $('#searchDrugCode,#searchDrugName,#searchCompName,#declareIns').bind('keydown', function(event) {
        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
            $('#selectc').click();
        }
    }); 
		
    $("#searchDrugCode").focus();//加载页面光标在第一个查询框内
    
        function search(page) {
            var searchDrugCode = $("#searchDrugCode").val();
            var searchDrugName = $("#searchDrugName").val();
            var searchCompName = $("#searchCompName").val();
            var declareIns = $("#declareIns").val();
            
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"drugCode":searchDrugCode, "drugName":searchDrugName, "compName":searchCompName,"declareIns":declareIns},
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
    
        $(function () {
            
            $("#gridlist").jqGrid({
                url: "getBidCollectDetailsByArea.html",
                mtype: "post",
                datatype: "json",
                postData: {"projId":"${projId}", "areaId":"${areaId}"},
                shrinkToFit:false,
                autowidth: true,
                height: 270,
                colNames: [
					'申报单位',
					'去年采购数量',
					'计划采购数量',
					'采购方式',
					'质量要求',
                    '药品编码', 
                    '通用名',
                    '剂型',
                    '规格', 
                    '转换系数',
                    '单位',
                    '材质',
                    '生产企业',
                    'projId'
                ],
                colModel: [
					{ name: 'declareIns', width: 150, align:"center", sortable: false},
					{ name: 'lasyProAmt', width: 100, align:"center", sortable: false},
					{ name: 'planProAmt', width: 100, align:"center", sortable: false},
					{ name: 'proMethod', width: 100, align:"center", sortable: false},
					{ name: 'qualityRequires', width: 200, align:"center", sortable: false},
                    { name: 'drugCode', width: 100, align:"center", sortable: false,
                        formatter:function(cellvalue, options, row) {
                        	var str = "<a href=\"javascript:void(0)\" onclick=\"showDrugInfo('"+row.drugCode+"','"+row.drugName+"')\">"+cellvalue+"</a>";
							return str;
                        }
                    },
                    { name: 'drugName', width: 200, align:"center", sortable: false },
                    { name: 'formName', width: 100, align:"center", sortable: false},
                    { name: 'specName', width: 100, align:"center", sortable: false},
                    { name: 'factor', width: 100, align:"center", sortable: false},
                    { name: 'unit', width: 50, align:"center", sortable: false},
                    { name: 'materialName', width: 100, align:"center", sortable: false},
                    { name: 'compName', width: 200, align:"center", sortable: false,
                    	formatter:function(cellvalue, options, row) {
                         	var str = "<a href=\"javascript:void(0)\" onclick=\"showCompInfo('"+row.compCode+"','"+row.compName+"')\">"+cellvalue+"</a>";
                         	return str;
                         }		
                    },
                    { name: 'projId',hidden:true, width: 10, align:"center", sortable: false}
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                caption: "${projName} - ${areaName} - 按地区汇总详情",
                jsonReader: {
                   
                },
                gridComplete:function(){
                    //序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                    //数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                }
            });
            
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
            
        });    
    </script>
</body>
</html>